<?php
namespace App\DAO;

use Swoole\Async\Redis;

class UserInfoDAO extends BaseDAO
{
    const CACHE_USER = 'userinfo#';
    function isExist($userid)
    {
       $ret = $this->get($userid,'user_id');
        if(!$ret)
        {
            return true;
        }
        return false;
    }

   function set($id, $attributes, $where)
   {
       \Swoole::getInstance()->redis->hMSet(self::CACHE_USER.$id,$attributes);
       return parent::set($id, $attributes, $where); // TODO: Change the autogenerated stub
   }

    function insert($attributes)
    {

        if($attributes['user_id'])
            \Swoole::getInstance()->redis->hMSet(self::CACHE_USER.$attributes['user_id'],$attributes);

        return parent::insert($attributes); // TODO: Change the autogenerated stub
    }

}
